import { Component, OnInit } from '@angular/core';
import { Carousel } from '../../model/carousel';
import { CarouselService } from '../../service/carousel.service';

@Component({
  selector: 'app-forshow',
  templateUrl: './forshow.component.html',
  styleUrls: ['./forshow.component.css']
})
export class ForshowComponent implements OnInit {
  cl:Array<Carousel>;

// images:Array<string>;
  constructor(private carouselservice:CarouselService) {
    this.cl=new Array();
    // for(let i=0;i<3;i++){
    //   let c=new Carousel();
    //   c.carouselid="id"+i;
    //   c.content="content"+i;
    //   c.title="title"+i;
    //   c.discription="discription"+i;
    //   c.pic="http://localhost:81/wf.jpg";

    //   this.cl.push(c);
    // }
   }

  ngOnInit() {
    //this.images = [1, 2, 3].map(() => `https://picsum.photos/900/500?random&t=${Math.random()}`);
  // this.images=new Array();
  // this.images.push('http://localhost:81/wf.jpg');
  // this.images.push('http://localhost:81/zxy.jpg');
  // this.images.push('http://localhost:81/es.jpg');
  
  this.cl=new Array();
   this.carouselservice.getCarouselList()
   .then((data:any)=>{
this.cl=data;
console.log(this.cl[0].pic);

   })
  }

}
